<template>
    <div>
        <wt-model-table
                :model="users"
                :value="pageData"
                :total="totalNumber"
                :params-data="paramsData"
                :allow-add="hasAddPermission"
                :allow-edit="hasEditPermission"
                :allow-remove="false"
                :min-handle-width="minWidth"
        >
        </wt-model-table>
    </div>
</template>
<script>
    import Vue from "vue"
    import ElementUI from 'element-ui';
	import ModelConfig from 'winged/utils/wt-model-config'
    import Users from '../js/config/user';
	import ModelTable from 'winged/components/wt-model-table';
	import FormUtils from 'winged/utils/wt-form-utils';
	import WtNewUser from "./wt-new-user";
	import Permission from 'winged/utils/wt-permission';
    Vue.use(ElementUI);
	Vue.component(ModelTable.name, ModelTable);
	Vue.component(WtNewUser.name, WtNewUser);
    export default{
        name : 'wt-user-list',
        props :{
            list :{
                type : Array ,
                required : true ,
            },
            count :{
				type : Number,
				default: 0
            },
			roles:{
            	type : [Object,Array],
                default : []
            },
            userInfo:{
				type : Object,
				default : {}
            }
        },
        data(){
            return {
                pageData: this.list,
                totalNumber: this.count,
				users: Users,
                paramsData: {
                	roles: this.roles,
					userInfo: this.userInfo
                },
				hasAddPermission: Permission.checkPermission('user-add'),
				hasEditPermission: Permission.checkPermission('user-auth'),
				hasDeletePermission: Permission.checkPermission('user-delete'),
				minWidth:120
            }
        },
    }
</script>
<style>
    .wt-new-users{
        margin: 15px 0 15px 0;
       float: right;
    }
</style>
